

import java.awt.BorderLayout;
import java.awt.CardLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.GraphicsEnvironment;
import java.awt.Toolkit;

import javax.swing.*;


/**
 * Sets up and launches the main window for the tealServ system
 * 
 */
public class StartSystem  {

	private static JFrame frame;
	
	 /**
	 * Creates a window and calls to the LogIn class
	 */
	public StartSystem(){
		frame = new JFrame();
		
		frame.setLayout(new BorderLayout());
		frame.setTitle("tealServ");
		frame.setDefaultCloseOperation(frame.DISPOSE_ON_CLOSE);
		
		/*These instructions obtain the max width and height of the computer screen */
		GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
        frame.setMaximizedBounds(ge.getMaximumWindowBounds());
        frame.setExtendedState(frame.getExtendedState() | frame.MAXIMIZED_BOTH);
		//Used to remove the borders - user cannot minimize, maximize, or close the window
        frame.setUndecorated(true);
		Color color = UIManager.getColor("activeCaptionBorder");
		frame.getRootPane().setBorder(BorderFactory.createLineBorder(color, 4));
		frame.setResizable(false);
		
		LogIn logIn = new LogIn();
    	frame.add(logIn);
		frame.pack();
		frame.setVisible(true);
	}//End of StartSystem
	

	/**
	 * Allows for panel switching by removing a panel, validating, adding a new panel, revalidating and repainting
	 * @param jp - the new panel to be added
	 */
	public static void switchPanel(JPanel jp){
		frame.getContentPane().removeAll();
		frame.getContentPane().validate();
		frame.getContentPane().add(jp);
		frame.getContentPane().revalidate();
		frame.getContentPane().repaint();
	}//End of switchPanel method
	
	
	
	/**
	 * Creates an instance of the StartSystem window
	 * @param args
	 */
	public static void main(String[] args) {
		
		new StartSystem();

	}//End of main method

}//End of Class
